package com.jams.goodox.entity;

import com.jams.goodox.net.BaseEntity;
import com.jams.goodox.utils.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by jams_zhen on 2017/5/24.
 */

public class InfoListResp extends BaseEntity{

    private DataBean data;

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public static class DataBean implements Mapper{
        private PageInfo pageInfo;
        private List<ResultListBean> resultList;

        public PageInfo getPageInfo() {
            return pageInfo;
        }

        public void setPageInfo(PageInfo pageInfo) {
            this.pageInfo = pageInfo;
        }

        public List<ResultListBean> getResultList() {
            return resultList;
        }

        public void setResultList(List<ResultListBean> resultList) {
            this.resultList = resultList;
        }

        @Override
        public List<InfoBean> transform() {
            List<InfoBean> infoBeanList=new ArrayList<>();
            if(resultList!=null&&resultList.size()>0){
                for(ResultListBean resultListBean:resultList) {
                    InfoBean infoBean=resultListBean.transform();
                    infoBeanList.add(infoBean);
                }
            }
            return infoBeanList;
        }

        public static class ResultListBean implements Mapper{
            private String noticeContent;//模板显示内容
            private String intime;
            private String resCode;
            private String noticeId;
            private String noticeTitle;
            private String dealHtmlContent;//列表显示内容
            private String refId;//活动获取的id

            @Override
            public InfoBean transform() {
                InfoBean infoBean=new InfoBean();
                infoBean.setInfoTitle(StringUtils.newString(noticeTitle));
                infoBean.setInfoContent(StringUtils.newString(dealHtmlContent));
                infoBean.setDetailMsg(StringUtils.newString(noticeContent));
                infoBean.setId(StringUtils.newString(noticeId));
                infoBean.setInfoTime(StringUtils.newString(intime));
                infoBean.setActiveType(StringUtils.newString(resCode));
                infoBean.setRefId(StringUtils.newString(refId));
                return infoBean;
            }

        }
    }
}
